package com.qdlc.p2p.biz.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.service.ScoreLotteryService;
import com.qdlc.p2p.dal.dao.ScoreLotteryDao;
import com.qdlc.p2p.dal.dto.ScoreLottery;

@Service("scoreLotteryService")
public class ScoreLotteryServiceImpl implements ScoreLotteryService {

    @Resource
    private ScoreLotteryDao scoreLotteryDao;

    @Override
    public List<ScoreLottery> getAllLottery() {
        return scoreLotteryDao.findAll();
    }

    @Override
    public ScoreLottery findById(long id) {
        return scoreLotteryDao.find(id);
    }

    @Override
    public void save(ScoreLottery scoreLottery) {
        scoreLottery.setAddTime(new Date());
        scoreLotteryDao.save(scoreLottery);
    }

    @Override
    public void update(ScoreLottery scoreLottery) {
        scoreLotteryDao.update(scoreLottery);
    }

    @Override
    public double getTotalRate() {
        return scoreLotteryDao.getTotalRate();
    }

}
